<!--
 * @description  :
 * @descriptionDetail:
 * @copyright    : 浙江烟草
 * @author       : mhb
 * @create       : 2023-01-17 11:06:06
-->
/**
 * @description  : 通知公告详情
 * @descriptionDetail : 通知公告详情
 * @copyright    : 浙江烟草
 * @author       : mc
 * @create       : 2022-12-05 15:47:59
 */
<template>
  <view class="page">
    <!-- #ifdef H5-ONLY -->
    <theme-navbar :is-white="false" :title="navTitle" :custom-back="goBack" style="z-index: 99999">
    </theme-navbar>
    <!-- #endif -->
    <view class="content u-page">
      <view class="main-content">
        <view class="html-lay">
          {{ publishObj.title }}
        </view>
        <view class="content-sub-title-lay">
          <text class="content-sub-title">
            {{ publishObj.publishOrgName }}
          </text>
          <span style="padding:0 14rpx"> | </span>
          <text class="content-sub-title-time">
            {{ publishObj.publishTime }}
          </text>
        </view>
      </view>
      <view v-html="publishObj.content" v-if="publishObj.content" class="detail-content-sty">
      </view>
      <view class="en-sty">
        <view style="font-size:26rpx">
          相关附件：
        </view>
        <attachment-upload :noticeUuid="noticeUuid"></attachment-upload>
      </view>
    </view>
    <view class="ctn-btm-lay" v-if="isShowFeedback == 1">
      <u-row>
        <u-col span="9">
          <u-input :border="true" v-model="feedbackContent" placeholder="请输入反馈内容..."></u-input>
        </u-col>
        <u-col span="3">
          <u-button type="primary" @click="feedBackClick">
            发送
          </u-button>
        </u-col>
      </u-row>
    </view>
  </view>
</template>

<script>
import teamNoticeService from "@/service/team/notice.service";
import attachmentUpload from "./attachmentUpload"
import moment from "moment";
export default{
  components:{
    attachmentUpload,
  },
  onLoad(opt) {
    let obj = this.getRouteParam();
    this.noticeUuid = obj.noticeUuid;
    console.log(obj, "opt");
    this.$nextTick(() => {
      this.isShowFeedback = obj.isShowFeedback;
    });
    this.init(obj.noticeUuid);
  },
  data(){
    return {
      feedbackContent:"",
      publishObj:{},
      noticeReceive:{},
      user: this.$store.state.userInfo,
      noticeUuid:'',
      isShowFeedback:"",
    };
  },
  methods:{
    init(id){
      this.$modal.showLoading('加载中...');
      teamNoticeService.getNoticeDetail({noticeUuid:id,}).then(res => {
        if (res.success) {
          this.$modal.hideLoading();
          this.publishObj = res.bean.noticeInfoPublish;
          // if(res.bean.isShowFeedback){
            // this.isShowFeedback = res.bean.isShowFeedback;
          // }
          if(res.bean.noticeReceive){
            this.noticeReceive = res.bean.noticeReceive;
          }
        }
      }).catch(err => {
        this.$modal.hideLoading();
        this.$u.toast('加载失败')
        console.log(err);
      })
    },
    feedBackClick(){
      let param = {
        status: '02',
        statusText:'已反馈',
        feedbackContent: this.feedbackContent,
        noticeReceiveUuid: this.noticeReceive.noticeReceiveUuid,
        feedbackTime: moment().format('YYYY年MM月DD日 HH:mm:ss'),
        feedbackPersonUuid: this.user.user.personUuid,
        feedbackPersonName: this.user.user.personName,
      };
      if(this.$u.test.isEmpty(this.feedbackContent)) 
      return this.$u.toast('请输入反馈内容')
      this.$modal.showLoading('正在发送中...');
      teamNoticeService.saveOrUpdate(param).then(res => {
        if (res.success) {
          this.$modal.hideLoading();
          this.backPrev({
            paramKey:'refresh',
            param:true,
          })
        }
      }).catch(err => {
        this.$modal.hideLoading();
        this.$u.toast('发送失败')
        console.log(err);
      })
    },
  },
}
</script>

<style scoped lang="scss">
	.content{
		background-color: white;
    padding-bottom: 50rpx;
	}
  .main-content{
    padding: 30rpx 0rpx 12rpx 28rpx;
    border-bottom: 2rpx solid $u-border-color;
  }
	.html-lay{
    font-size: 32rpx;
    font-weight: bold;
    padding-bottom: 3px;
	}
  .detail-content-sty{
    font-size: 30rpx;
    line-height: 30px;
    padding: 28rpx;
    border-bottom: 2rpx solid $u-border-color;
    word-wrap: break-word;
  }
	.ctn-btm-lay{
		position: fixed;
		display: flex;
		flex-direction: column;
		width: 100%;
    padding: 10rpx 28rpx 10rpx 4rpx;
    background-color: #fff;
		bottom: 0;
	}
	.ctm-title{
		font-size: $cm-form-item-label-font-size;
		color: $u-main-color;
		margin-bottom: 30rpx;
		font-weight: 600;
	}
	.btn-fdbk{
		width: 100%;
		margin-top: 20rpx;
	}
  .content-sub-title-lay{
		margin-top: 20rpx;
		margin-bottom: 20rpx;
    font-size: 24rpx;
		display: inline-flex;
		flex-direction: row;
		justify-content: space-between;
		align-items: center;
	}
  .content-sub-title-lay{
    font-size: 24rpx;
    color: $cm-form-subtitle-color;
  }
	.content-sub-title{
    font-size: 26rpx;
		color: $cm-form-subtitle-color;
	}
  .content-sub-title-time{
    font-size: 26rpx;
  }
  .en-sty{
    padding: 10px 14px 15px 14px
  }
  /deep/p{
    text-indent: inherit !important;
  }
</style>
